<?php
$fangshi_get=$_GET['fangshi']; 
if($fangshi_get==''){ $fangshi_and='';}
else{$fangshi_and=" and fangshi='$fangshi_get'";}
$keyword=$_GET['keyword']; 
$page = !($_GET['page'])?'1':intval($_GET['page']);
$pagesize=10;
$page2=($page-1)*$pagesize;

$sql="select * from ".$BIAOTOU."dhdingdan where (ddusername like '%".$keyword."%' or name like '%".$keyword."%') $fangshi_and";
$rs = mysql_query($sql);
$total = mysql_num_rows($rs);	
	
$sql="select * from ".$BIAOTOU."dhdingdan where (ddusername like '%".$keyword."%' or name like '%".$keyword."%') $fangshi_and order by id desc limit $page2,$pagesize";
$rs = mysql_query($sql);
	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link href="../css/style.css" rel="stylesheet" type="text/css">
</head>

<body topmargin="5" leftmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="282" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table cellspacing="0" width="100%" height="207" style="border:1px  solid #DCEAF7;">
            <tr>
              <td width="551" height="30" align="left" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;<img src="../images/arrow.gif" width="16" height="22" align="absmiddle" /> 兑换管理&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="?act=duihuan_list&fangshi=1">积分兑换列表</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="?act=duihuan_list&fangshi=2">现金兑换列表</a></strong></td>
              <form id="form1" name="form1" method="get" action="">
              <td width="438" align="left" bgcolor="E9F2FB" class="bigtext">
              <label>兑换人或会员名<input type="text" class="button3" name="keyword" /></label>
              <input type="hidden" name="act" value="duihuan_list" />
                <label><input type="submit" name="Submit" value="查找" /></label></td></form>
              <td width="229" height="30" align="right" bgcolor="E9F2FB" class="bigtext">共有 <b><?php echo $total;?></b> 条记录&nbsp;&nbsp;</td>
            </tr>
            <tr>
              <td colspan="3" valign="top"><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td valign="top"><table width="100%" border=1 cellpadding=0 cellspacing=0
style="border-collapse: collapse" bordercolor="#dddddd">
                  
                    <tr>
                      <td width="6%" height="30" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;会员</strong></td>
                      <td width="15%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;商品名称</strong></td>
                      <td width="" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;会员备注</strong></td>
                      <td width="12%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;兑换时间</strong></td>
					  <td width="8%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;兑换IP</strong></td>
                      <td width="6%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;兑换方式</strong></td>    
                      <td width="9%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;兑换状态</strong></td>               
                      <td width="8%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;执行操作</strong></td>
                    </tr>
					<?php
					while ($row = mysql_fetch_array($rs))
					{
						 $st="<font color=#0066CC>兑换中</font>";
						 if($row["dhsh"]==0)
							{ $st= "<font color=#ff3300>兑换审核中...</font>";}
						 else if($row["dhsh"]==1)
							{$st= "<font color=#009900>兑换成功</font>";}
						 else
						 {$st= "<font color=#333333>兑换失败</font>";}?>
						
						
						<tr>
                      	<td align=center height=30 class=bigtext>&nbsp;<a href='../mingxi.php?username=<?=$row["ddusername"]?>' title="查看明细" class=link4><?=$row["ddusername"]?></a></td>
						<td align=left class=bigtext>&nbsp;<a href='../../huangou.php?id=<?=$row["spid"]?>' target=_blank><?=$row["name"]?></a></td>
						<td align=center class=bigtext>&nbsp;<?=$row["remarks"]?></td>
						<td align=center class=bigtext>&nbsp;<?=$row["addtime"]?></td>
						<td align=center class=bigtext>&nbsp;<?=$row["ip"]?><a href='http://www.ip138.com/ips.asp?ip=<?=$row["ip"]?>' target=_blank class=link4>&nbsp;查</a></td>
						<td align=center class=bigtext>&nbsp;<?=$fangshi[$row["fangshi"]]?></td>
						<td align=center class=bigtext>&nbsp;<?=$status[$row["status"]]?></td>
                        <td align=center class=bigtext>&nbsp;<a href='admin.php?act=duihuan_qren&id=<?=$row["id"]?>' class=link4>确认</a>	<a href='admin.php?act=duihuan_tui&id=<?=$row["id"]?>' class=link4>退回</a></td>
						</tr>
					<?php }?>
                  </table>
				  <div class="yahoo2" style=" margin-top:30px;"><?php 
				pageft($total,$pagesize,1,1,0,10,"?act=duihuan_list&fangshi=".$fangshi_get."&keyword=".urlencode($keyword));
				echo $pagenav;?></div></td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
</body>
</html>